/*    */ package com.newcrm.webapi.sub;
/*    */ 
/*    */ import com.newcrm.bean.CustomerInfo;
/*    */ import com.newcrm.db.ImportManager;
/*    */ import com.newcrm.exception.NotFoundException;
/*    */ import com.newcrm.util.Util;
/*    */ import com.newcrm.webapi.AbstractAction;
/*    */ import com.newcrm.webapi.AbstractHttpServlet;
/*    */ import java.io.IOException;
/*    */ import java.util.ArrayList;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ import javax.servlet.RequestDispatcher;
/*    */ import javax.servlet.ServletException;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import org.apache.log4j.Logger;
/*    */ 
/*    */ public class CustomerImportResult extends AbstractAction
/*    */ {
/* 24 */   private static Logger logger = Logger.getLogger(CustomerImportResult.class
/* 25 */     .getName());
/*    */ 
/*    */   public CustomerImportResult(AbstractHttpServlet servlet)
/*    */   {
/* 28 */     super(servlet);
/*    */   }
/*    */ 
/*    */   public void parse(HttpServletRequest request, HttpServletResponse response)
/*    */     throws IOException, ServletException, NotFoundException
/*    */   {
/* 35 */     int importId = Util.str2Int(request.getParameter("importId"));
/* 36 */     int successNum = Util.str2Int(request.getParameter("successNum"));
/* 37 */     int existNum = Util.str2Int(request.getParameter("existNum"));
/* 38 */     int errorNum = Util.str2Int(request.getParameter("errorNum"));
/* 39 */     String existCustomerIds = request.getParameter("existCustomerIds");
/*    */ 
/* 42 */     List sampleItems = new ArrayList();
/*    */ 
/* 44 */     ImportManager manager = new ImportManager();
/*    */     try
/*    */     {
/* 47 */       List result = manager
/* 48 */         .getTop5Customer(importId);
/* 49 */        for (Object itemO : result) {
            Map item = (Map)itemO;
/* 50 */         CustomerInfo info = new CustomerInfo();
/* 51 */         info.id = Util.str2Int(item.get("CustomerId"));
/* 52 */         info.type = 1;
/* 53 */         info.name = ((String)item.get("Name"));
/* 54 */         info.parentId = Util.str2Int(item.get("ParentCustomerId"));
/* 55 */         info.parentName = ((String)item.get("ParentCustomerName"));
/* 56 */         sampleItems.add(info);
/*    */       }
/*    */     } catch (Exception e) {
/* 59 */       logger.warn("get import customer info failed", e);
/*    */     }
/* 61 */     request.setAttribute("sampleItems", sampleItems);
/* 62 */     request.setAttribute("importId", Integer.valueOf(importId));
/* 63 */     request.setAttribute("successNum", Integer.valueOf(successNum));
/* 64 */     request.setAttribute("existNum", Integer.valueOf(existNum));
/* 65 */     request.setAttribute("errorNum", Integer.valueOf(errorNum));
/* 66 */     request.setAttribute("existCustomerIds", existCustomerIds);
/* 67 */     request.getRequestDispatcher("/customer_import_result.jsp").forward(
/* 68 */       request, response);
/*    */   }
/*    */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.webapi.sub.CustomerImportResult
 * JD-Core Version:    0.6.1
 */